import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class Widget_CupertinoAlertDialog_Page extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text("CupertinoAlertDialog"),
          ),
          body: Center(
              child: RaisedButton(
                  child: Text("按钮"),
                  onPressed: () {
                    showDialog(context: context,
                        builder: (BuildContext context) {
                          return CupertinoAlertDialog(
                            title: Text("这是一个iOS风格的对话框"),
                            content: SizedBox(
                              height: 100.0,
                              child: SingleChildScrollView(
                                child: ListBody(
                                  children: <Widget>[
                                    Text("第1行"),
                                    Text("第2行"),
                                    Text("第3行"),
                                    Text("第4行"),
                                    Text("第5行"),
                                    Text("第6行"),
                                    Text("第7行"),
                                    Text("第8行"),
                                    Text("第9行"),
                                  ],
                                ),
                              ),
                            ),
                            actions: <Widget>[
                              CupertinoDialogAction(
                                child: Text("取消"),
                                onPressed: () {
                                  Navigator.pop(context);
                                  print("取消");
                                },
                              ),
                              CupertinoDialogAction(
                                child: Text("确定"),
                                onPressed: () {
                                  print("确定");
                                },
                              ),
                            ],
                          );
                        }
                    );
                  }
              )
          )
      ),
    );
  }
}

/**
 *  ios风格的对话框
 *
 * const CupertinoAlertDialog({
    Key key,
    this.title,//标题
    this.content,//内容
    this.actions = const <Widget>[],//按钮
    this.scrollController,//
    this.actionScrollController,//
    })
 */
